/**
 * 项目名：phms3
 * 日期：    2019-12-01 17:02:29
 * Copyright (c) 2015- HTSC-版权所有
 */

package com.joysuch.wwyt.bp.entity;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import com.joysuch.wwyt.dataperm.annotation.DataPermissionField;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.Proxy;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;

@EntityListeners({AuditingEntityListener.class, AutoSetCommonFieldListener.class})
@Entity
@Table(name = "wwyt_bp_production_facility")
@SQLDelete(sql = "update wwyt_bp_production_facility set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_bp_production_facility set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
@Proxy(lazy = false)
public class BpProductionFacility implements java.io.Serializable {

    // columns START
    // ID
    private Long id;
    // 租户
    private Long tenentId;
    // 组织机构代码
    private String orgCode;
    // 装置编号
    private String code;
    // 装置名称
    private String name;
    // 设备型号
    private String equipmentModel;
    // 装置类型
    private Long type;
    // 是否关键装置
    private String keyEquipment;
    // 所属部门
    @DataPermissionField(sqlColumn = "depart_id")
    private Long departId;
    // 装置功能
    private String functions;
    // 装置状态
    private Integer state;
    // 装置生产能力
    private String productionAbility;
    // 装置技术条件
    private String technicalCondition;
    // 所属重大危险源单元
    private Long majorHazardId;
    // 装置位置
    private String location;
    // 创建人
    private Long createBy;
    // 创建时间
    private java.time.LocalDateTime createTime;
    // 更新人
    private Long updateBy;
    // 更新时间
    private java.time.LocalDateTime updateTime;
    // 删除标记
    private String deleteFlag;
    // 所属危险化工工艺
    private Long craftId;
    // 所属重大危险源单元
    private String majorHazardUnit;
    // 所属重大危险源单元编号
    private String majorHazardUnitCode;
    // columns END

    // 维修状态
    private Integer repairState;
    //保养状态
    private Integer maintainState;
    // 所在部位
    private String deviceLocation;
    // 所属区域
    private Long riskDistrictId;
    // 负责人
    private Long personInChargeId;
    // 负责人部门
    private Long picDepartId;
    // 生产日期
    private java.util.Date manufactureDate;
    // 投用日期
    private java.util.Date putIntoUseDate;
    // 使用期限（月）
    private Integer serviceLifeMonths;
    // 保养周期（天）
    private Integer maintainPeriodDays;
    // 提前提醒（天）
    private Integer remindAheadDays;
    // 生命周期
    private String lifecycle;
    // 报废日期
    private java.util.Date scrapDate;
    // 登记人
    private Long scrapRegisterUserId;
    // 登记时间
    private java.util.Date scrapRegisterTime;
    // 附件
    private Long scrapAttachmentId;
    // 报废说明
    private String scrapDescription;
    //外部接口关联ID
    private String refId;
    //外部接口关联URL
    private String refUrl;
    //是否是安全装置
    private String safeStatus;
    //到期时间
    private Date validityDate;

    //维修金额
    private Double repairAmount;

    //保养金额
    private Double maintenanceAmount;

    //设备装置位号
    private String tagNumber;
    //供应商
    private String supplier;
    //检查周期
    private Integer inspectionDays;
    //检测周期
    private Integer detectDays;

    @Column(name = "maintain_state")
    public Integer getMaintainState() {
        return maintainState;
    }

    public void setMaintainState(Integer maintainState) {
        this.maintainState = maintainState;
    }

    @Column(name = "INSPECTION_DAYS")
    public Integer getInspectionDays() {
        return inspectionDays;
    }

    public void setInspectionDays(Integer inspectionDays) {
        this.inspectionDays = inspectionDays;
    }

    @Column(name = "DETECT_DAYS")
    public Integer getDetectDays() {
        return detectDays;
    }

    public void setDetectDays(Integer detectDays) {
        this.detectDays = detectDays;
    }

    public String getTagNumber() {
        return tagNumber;
    }

    public void setTagNumber(String tagNumber) {
        this.tagNumber = tagNumber;
    }

    public String getSupplier() {
        return supplier;
    }

    public void setSupplier(String supplier) {
        this.supplier = supplier;
    }

    @Column(name = "repair_amount")
    public Double getRepairAmount() {
        return repairAmount;
    }

    public void setRepairAmount(Double repairAmount) {
        this.repairAmount = repairAmount;
    }

    @Column(name = "maintenance_amount")
    public Double getMaintenanceAmount() {
        return maintenanceAmount;
    }

    public void setMaintenanceAmount(Double maintenanceAmount) {
        this.maintenanceAmount = maintenanceAmount;
    }

    @Column(name = "REPAIR_STATE")
    public Integer getRepairState() {
        return repairState;
    }

    public void setRepairState(Integer repairState) {
        this.repairState = repairState;
    }

    @Column(name = "DEVICE_LOCATION", length = 500)
    public String getDeviceLocation() {
        return deviceLocation;
    }

    public void setDeviceLocation(String deviceLocation) {
        this.deviceLocation = deviceLocation;
    }

    @Column(name = "RISK_DISTRICT_ID")
    public Long getRiskDistrictId() {
        return riskDistrictId;
    }

    public void setRiskDistrictId(Long riskDistrictId) {
        this.riskDistrictId = riskDistrictId;
    }

    @Column(name = "PERSON_IN_CHARGE_ID")
    public Long getPersonInChargeId() {
        return personInChargeId;
    }

    public void setPersonInChargeId(Long personInChargeId) {
        this.personInChargeId = personInChargeId;
    }

    @Column(name = "PIC_DEPART_ID")
    public Long getPicDepartId() {
        return picDepartId;
    }

    public void setPicDepartId(Long picDepartId) {
        this.picDepartId = picDepartId;
    }

    @Column(name = "MANUFACTURE_DATE")
    public java.util.Date getManufactureDate() {
        return manufactureDate;
    }

    public void setManufactureDate(java.util.Date manufactureDate) {
        this.manufactureDate = manufactureDate;
    }

    @Column(name = "PUT_INTO_USE_DATE")
    public java.util.Date getPutIntoUseDate() {
        return putIntoUseDate;
    }

    public void setPutIntoUseDate(java.util.Date putIntoUseDate) {
        this.putIntoUseDate = putIntoUseDate;
    }

    @Column(name = "SERVICE_LIFE_MONTHS")
    public Integer getServiceLifeMonths() {
        return serviceLifeMonths;
    }

    public void setServiceLifeMonths(Integer serviceLifeMonths) {
        this.serviceLifeMonths = serviceLifeMonths;
    }

    @Column(name = "MAINTAIN_PERIOD_DAYS")
    public Integer getMaintainPeriodDays() {
        return maintainPeriodDays;
    }

    public void setMaintainPeriodDays(Integer maintainPeriodDays) {
        this.maintainPeriodDays = maintainPeriodDays;
    }

    @Column(name = "REMIND_AHEAD_DAYS")
    public Integer getRemindAheadDays() {
        return remindAheadDays;
    }

    public void setRemindAheadDays(Integer remindAheadDays) {
        this.remindAheadDays = remindAheadDays;
    }

    @Column(name = "LIFECYCLE", length = 1)
    public String getLifecycle() {
        return lifecycle;
    }

    public void setLifecycle(String lifecycle) {
        this.lifecycle = lifecycle;
    }

    @Column(name = "SCRAP_DATE")
    public java.util.Date getScrapDate() {
        return scrapDate;
    }

    public void setScrapDate(java.util.Date scrapDate) {
        this.scrapDate = scrapDate;
    }

    @Column(name = "SCRAP_REGISTER_USER_ID")
    public Long getScrapRegisterUserId() {
        return scrapRegisterUserId;
    }

    public void setScrapRegisterUserId(Long scrapRegisterUserId) {
        this.scrapRegisterUserId = scrapRegisterUserId;
    }

    @Column(name = "SCRAP_REGISTER_TIME")
    public java.util.Date getScrapRegisterTime() {
        return scrapRegisterTime;
    }

    public void setScrapRegisterTime(java.util.Date scrapRegisterTime) {
        this.scrapRegisterTime = scrapRegisterTime;
    }

    @Column(name = "SCRAP_ATTACHMENT_ID")
    public Long getScrapAttachmentId() {
        return scrapAttachmentId;
    }

    public void setScrapAttachmentId(Long scrapAttachmentId) {
        this.scrapAttachmentId = scrapAttachmentId;
    }

    @Column(name = "SCRAP_DESCRIPTION", length = 65535)
    public String getScrapDescription() {
        return scrapDescription;
    }

    public void setScrapDescription(String scrapDescription) {
        this.scrapDescription = scrapDescription;
    }

    public void setId(Long value) {
        this.id = value;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "Id", unique = true, nullable = false)
    public Long getId() {
        return this.id;
    }

    @Column(name = "TENENT_ID")
    public Long getTenentId() {
        return this.tenentId;
    }

    public void setTenentId(Long value) {
        this.tenentId = value;
    }

    @Column(name = "ORG_CODE", length = 100)
    public String getOrgCode() {
        return this.orgCode;
    }

    public void setOrgCode(String value) {
        this.orgCode = value;
    }

    @Column(name = "CODE", length = 30)
    public String getCode() {
        return this.code;
    }

    public void setCode(String value) {
        this.code = value;
    }

    @Column(name = "NAME", length = 30, nullable = false)
    public String getName() {
        return this.name;
    }

    public void setName(String value) {
        this.name = value;
    }

    @Column(name = "EQUIPMENT_MODEL", length = 100)
    public String getEquipmentModel() {
        return this.equipmentModel;
    }

    public void setEquipmentModel(String value) {
        this.equipmentModel = value;
    }

    @Column(name = "TYPE")
    public Long getType() {
        return this.type;
    }

    public void setType(Long value) {
        this.type = value;
    }

    @Column(name = "KEY_EQUIPMENT")
    public String getKeyEquipment() {
        return this.keyEquipment;
    }

    public void setKeyEquipment(String value) {
        this.keyEquipment = value;
    }

    @Column(name = "DEPART_ID")
    public Long getDepartId() {
        return this.departId;
    }

    public void setDepartId(Long value) {
        this.departId = value;
    }

    @Column(name = "FUNCTIONS", length = 200)
    public String getFunctions() {
        return this.functions;
    }

    public void setFunctions(String value) {
        this.functions = value;
    }

    @Column(name = "STATE")
    public Integer getState() {
        return this.state;
    }

    public void setState(Integer value) {
        this.state = value;
    }

    @Column(name = "PRODUCTION_ABILITY", length = 300)
    public String getProductionAbility() {
        return this.productionAbility;
    }

    public void setProductionAbility(String value) {
        this.productionAbility = value;
    }

    @Column(name = "TECHNICAL_CONDITION", length = 300)
    public String getTechnicalCondition() {
        return this.technicalCondition;
    }

    public void setTechnicalCondition(String value) {
        this.technicalCondition = value;
    }

    @Column(name = "MAJOR_HAZARD_ID")
    public Long getMajorHazardId() {
        return this.majorHazardId;
    }

    public void setMajorHazardId(Long value) {
        this.majorHazardId = value;
    }

    @Column(name = "LOCATION", length = 128)
    public String getLocation() {
        return this.location;
    }

    public void setLocation(String value) {
        this.location = value;
    }

    @org.springframework.data.annotation.CreatedBy
    @Column(name = "CREATE_BY")
    public Long getCreateBy() {
        return this.createBy;
    }

    public void setCreateBy(Long value) {
        this.createBy = value;
    }

    @org.springframework.data.annotation.CreatedDate
    @Column(name = "CREATE_TIME")
    public java.time.LocalDateTime getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(java.time.LocalDateTime value) {
        this.createTime = value;
    }

    @org.springframework.data.annotation.LastModifiedBy
    @Column(name = "UPDATE_BY")
    public Long getUpdateBy() {
        return this.updateBy;
    }

    public void setUpdateBy(Long value) {
        this.updateBy = value;
    }

    @org.springframework.data.annotation.LastModifiedDate
    @Column(name = "UPDATE_TIME")
    public java.time.LocalDateTime getUpdateTime() {
        return this.updateTime;
    }

    public void setUpdateTime(java.time.LocalDateTime value) {
        this.updateTime = value;
    }

    @Column(name = "DELETE_FLAG", length = 2)
    public String getDeleteFlag() {
        return this.deleteFlag;
    }

    public void setDeleteFlag(String value) {
        this.deleteFlag = value;
    }

    @Column(name = "CRAFT_ID")
    public Long getCraftId() {
        return this.craftId;
    }

    public void setCraftId(Long value) {
        this.craftId = value;
    }

    @Column(name = "major_hazard_unit", length = 100)
    public String getMajorHazardUnit() {
        return this.majorHazardUnit;
    }

    public void setMajorHazardUnit(String value) {
        this.majorHazardUnit = value;
    }

    @Column(name = "major_hazard_unit_code", length = 10)
    public String getMajorHazardUnitCode() {
        return this.majorHazardUnitCode;
    }

    public void setMajorHazardUnitCode(String value) {
        this.majorHazardUnitCode = value;
    }

    @Column(name = "ref_id", length = 64)
    public String getRefId() {
        return refId;
    }

    public void setRefId(String refId) {
        this.refId = refId;
    }

    @Column(name = "ref_url", length = 512)
    public String getRefUrl() {
        return refUrl;
    }

    public void setRefUrl(String refUrl) {
        this.refUrl = refUrl;
    }

    @Column(name = "safe_status", length = 512)
    public String getSafeStatus() {
        return safeStatus;
    }

    public void setSafeStatus(String safeStatus) {
        this.safeStatus = safeStatus;
    }

    @Column(name = "validity_date", length = 512)
    public Date getValidityDate() {
        return validityDate;
    }

    public void setValidityDate(Date validityDate) {
        this.validityDate = validityDate;
    }

    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId())
                .append("tenentId", getTenentId()).append("orgCode", getOrgCode()).append("code", getCode())
                .append("name", getName()).append("equipmentModel", getEquipmentModel()).append("type", getType())
                .append("keyEquipment", getKeyEquipment()).append("departId", getDepartId())
                .append("functions", getFunctions()).append("state", getState())
                .append("productionAbility", getProductionAbility())
                .append("technicalCondition", getTechnicalCondition()).append("majorHazardId", getMajorHazardId())
                .append("location", getLocation()).append("createBy", getCreateBy())
                .append("createTime", getCreateTime()).append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime()).append("deleteFlag", getDeleteFlag())
                .append("craftId", getCraftId()).append("majorHazardUnit", getMajorHazardUnit())
                .append("majorHazardUnitCode", getMajorHazardUnitCode())
                .append("inspectionDays", getInspectionDays())
                .append("detectDays", getDetectDays()).toString();
    }

    public int hashCode() {
        return new HashCodeBuilder().append(getId()).toHashCode();
    }

    public boolean equals(Object obj) {
        if (obj instanceof BpProductionFacility == false)
            return false;
        if (this == obj)
            return true;
        BpProductionFacility other = (BpProductionFacility) obj;
        return new EqualsBuilder().append(getId(), other.getId()).isEquals();
    }
}
